package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduXzjhOrgIntegration;
import com.jwsoft.manager.common.vo.eduXzjhOrg.EduXzjhOrgVO;
import com.jwsoft.manager.common.vo.eduXzjhOrg.EduXzjhOrgKeyVO;
import com.jwsoft.manager.common.vo.eduXzjhOrg.EduXzjhOrgQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 学在金华单位管理网关
 *
 * @author chenzh
 * @since 2024-03-24
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "学在金华单位管理", description = "学在金华单位管理")
public class EduXzjhOrgController {

    @Autowired
    public EduXzjhOrgIntegration eduXzjhOrgIntegration;

    @Operation(summary = "学在金华单位管理分页查询",description = "学在金华单位管理分页查询")
    @PostMapping(value = "/xzjhOrg0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduXzjhOrgVO>> getList(@RequestBody @Validated EduXzjhOrgQueryVO vo) {
        return AppResponse.successData(eduXzjhOrgIntegration.getList(vo));
    }

    @Operation(summary = "学在金华单位管理根据主键查询详情",description = "学在金华单位管理根据主键查询详情")
    @PostMapping(value = "/xzjhOrg0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduXzjhOrgVO> getById(@RequestBody @Validated EduXzjhOrgKeyVO vo) {
        return AppResponse.successData(eduXzjhOrgIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学在金华单位管理新增",description = "学在金华单位管理新增")
    @PostMapping(value = "/xzjhOrg0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduXzjhOrgVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduXzjhOrgVO vo) {
        return AppResponse.successData(eduXzjhOrgIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学在金华单位管理修改",description = "学在金华单位管理修改")
    @PostMapping(value = "/xzjhOrg0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduXzjhOrgVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduXzjhOrgVO vo) {
        return AppResponse.successData(eduXzjhOrgIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "学在金华单位管理删除",description = "学在金华单位管理删除")
    @PostMapping(value = "/xzjhOrg0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduXzjhOrgKeyVO vo) {
        eduXzjhOrgIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
